<template>
	<el-config-provider :locale="locale">
		<router-view />
	</el-config-provider>
</template>

<script setup lang="ts">
import { computed } from 'vue';
import { useSettingStore } from '@/store/setting';
// 导入 Element Plus 语言包
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import en from 'element-plus/es/locale/lang/en';

const settingStore = useSettingStore();

// 根据我们自己的 setting store 来动态切换 Element Plus 的语言
const locale = computed(() => {
	return settingStore.language === 'zh-cn' ? zhCn : en;
});
</script>
